Skip to content

Add markdown alternate link to page heads#722

Closed
nearestnabors wants to merge 6 commits intomainfrom
feature/add-markdown-alternate-link
Closed

Add markdown alternate link to page heads#722
nearestnabors wants to merge 6 commits intomainfrom
feature/add-markdown-alternate-link

Conversation

@nearestnabors
Copy link
Contributor

Summary

  • Adds a <link rel="alternate" type="text/markdown"> tag to every page's <head> element
  • Allows crawlers to discover the markdown version of each page at /path/to/page.md
  • Handles root paths (//index.md) and trailing slashes

Test plan

  • Verify the link tag appears in page source
  • Confirm the href correctly maps to the markdown path for various pages

🤖 Generated with Claude Code

Adds a <link rel="alternate" type="text/markdown"> tag to every page's
<head> element, allowing crawlers to discover the markdown version of
each page at /path/to/page.md.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Feb 6, 2026 3:06pm

Request Review

@teallarson
Copy link
Contributor

Screenshot 2026-02-04 at 1 59 24 PM I am not seeing these in the deploy preview

Replace CommonJS require() with ES module imports and __dirname with
import.meta.dirname to fix lint error.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Resolve conflict in update-example-dates.js by using import.meta.dirname
(simpler modern Node.js API) instead of fileURLToPath approach.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@nearestnabors
Copy link
Contributor Author

@teallarson works
image

Verifies that:
- getMarkdownAlternatePath generates correct .md paths
- Every page.mdx file maps to a valid markdown alternate path
- All locales have correctly formed markdown alternate paths

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@teallarson
Copy link
Contributor

@nearestnabors is it supposed to always point to home.md or should it point to one for the page the user is on?
Screenshot 2026-02-05 at 9 13 07 AM

The middleware file was renamed to proxy.ts in a previous commit, which
broke the x-pathname header injection needed for the markdown alternate
link feature. Renaming back to middleware.ts and updating the function
export name restores this functionality.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@nearestnabors
Copy link
Contributor Author

A bit of a rabbit hole. Prefer this #734

auto-merge was automatically disabled February 7, 2026 00:10

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants